﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RaygunDiplomacy.Entities
{
   public class Statistic
   {
      public string Name { get; set; }
      public float BaseValue { get; set; }

      List<StatisticSource> sources = new List<StatisticSource>();

      public void AddValueSource(StatisticSource source)
      {
         sources.Add(source);
      }

      public float Value
      {
         get
         {
            return BaseValue + sources.Sum(s => s.Value);
         }
      }
   }

   public class StatisticSource
   {
      private float value;

      public float Value
      {
         get { return value; }
         set
         {
            if (this.value != value)
            {
               this.value = value;
            }
         }
      }

      public string Name
      {
         get;
         set;
      }

      public StatisticSource(string name, float value)
      {
         this.value = value;
      }
   }
}
